A:
It is well-known that Jumu`ah Prayer is not obligatory for travelers. However, if the traveler offers Jumu`ah Prayer; it is considered valid and regarded as a substitute for Zhuhr (noon) Prayer. According to what is mentioned in the question, those who left their town to go to the other one are travelers, and they prayed Jumu`ah outside the town with the people of the town; thus, their Prayer is valid. There is no apparent reason why we should declare the prayer of the people of the town who prayed Jumu`ah in a valley which is 1 km from their town, invalid. This is because scholars mentioned the permissibility of offering Jumu`ah Prayer in the desert which is near their premises. This is based on what was narrated by
Abu Dawud and
Al-Daraqutny
on the authority of
Ka`b ibn Malik (may Allah be pleased with him)
who said:
As`ad ibn Zurarah was the first person who led us in Jumu`ah Prayer in Hazm Al-Nabit in a place called Al-Khadmat. It was said: 'How many were you on that day?' He said: 'Forty men'.
(Part No. 8; Page No. 209)
Al-Bayhaqy said: 'This Hadith has an authentic Sanad, meaning, chain of narrators'. Hence, the questioner should know the validity of the Jumu`ah Prayer that was performed by those people even though they should have performed it in the Masjid (mosque).May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.